# Based on Arch's PKGBUILD

_realname=tklib
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=0.6
pkgrel=3
pkgdesc="A companion to Tcllib, for Tk related packages (mingw-w64)"
arch=('any')
url='https://core.tcl.tk/tklib/home'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-tk" "${MINGW_PACKAGE_PREFIX}-tcllib")
source=("https://github.com/tcltk/tklib/archive/tklib_${pkgver/./_}.tar.gz"
        '001-no-dateentry-test-code.patch')
sha256sums=('d65f4dfd241e37cd45a8b91d030099215e41715b9d8d42652756c270695ca3ff'
            '9f4d5cb511bc9724d4f7684e0979e616f6919b74a1b3c9e995e0967e1d0cb9e5')

prepare() {
  cd ${srcdir}/tklib-tklib_${pkgver/./_}
  patch -Np1 -i "${srcdir}/001-no-dateentry-test-code.patch"
}

build() {
  cd ${srcdir}/tklib-tklib_${pkgver/./_}
  ./configure --prefix="${MINGW_PREFIX}"
  make all
}

package() {
  cd ${srcdir}/tklib-tklib_${pkgver/./_}
  make DESTDIR="${pkgdir}" install
  mkdir -p ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/
  cp license.terms ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
